<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/web/commons/global.jsp"%>
<c:set var="isNotShowLoginBar" value="true"></c:set>

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<title>极乐佛经网-提供大藏经下载大全_佛经念诵_经书抄写_助印经书_经书结缘</title>

<meta name="keywords" content="极乐佛经注册,极乐佛经,极乐佛经网,极乐佛经官网" />
<meta name="description"
	content="极乐佛经|极乐佛经网|佛经大全|佛经下载|佛经念诵|经书抄写|助印经书|经书结缘-极乐佛经网。极乐佛经网是由净顺居士发心为广大佛友所编辑整理的在线看经、在线阅读佛经平台；包含佛经原文，佛经译文，佛经注音，佛经故事，佛经视 频，大藏经等相关佛教经典大全；让更多的佛友能从中学习到佛经、佛法的善知识！" />

<link rel="shortcut icon"
	href="${baseUrl }/resources/img/favicon.ico?a=3" type="image/x-icon" />
<link rel="bookmark" href="${baseUrl }/resources/img/favicon.ico?a=3"
	type="image/x-icon" />
<link rel="stylesheet"
	href="${baseUrl }/resources/bootstrap-3.3.5/css/bootstrap.min.css" />
<link
	href="${baseUrl }/resources/font/Font-Awesome-3.2.1/css/font-awesome.min.css"
	rel="stylesheet" />
<link rel="stylesheet" href="${baseUrl }/resources/css/app.css" />
<link rel="stylesheet" href="${baseUrl }/resources/css/register.css" />

<script src="${baseUrl }/resources/js/jquery-2.1.4.min.js"
	type="text/javascript">
	
</script>

<script src="${baseUrl }/resources/bootstrap-3.3.5/js/bootstrap.min.js"
	type="text/javascript">
	
</script>

<script src="${baseUrl }/resources/js/common.js" type="text/javascript"></script>

</head>

<body>
	<%@ include file="/WEB-INF/jsp/web/commons/header.jsp"%>

	<div class="main-content-wrapper">
		<div class="main-content-wrapper-split">
			<section class="main-content">
				<div class="register-div">
					<div class="register-form-div">

						<form class="form-horizontal register-form">
							<fieldset>
								<div id="legend" class="">
									<legend class="form-legend">
										注册 <span class="login-entry">已有账号?<a
											href="${baseUrl }/login/page.html">直接登入</a></span>
									</legend>
								</div>
								<div class="form-group">
									<label for="inputAccount" class="col-sm-2 control-label">账户</label>
									<div class="col-sm-10">
										<input type="email" class="form-control" id="inputAccount"
											placeholder="请输入手机号">
									</div>
								</div>
								<div class="form-group">
									<label for="inputPassword" class="col-sm-2 control-label">密码</label>
									<div class="col-sm-10">
										<input type="password" class="form-control" id="inputPassword"
											placeholder="请输入密码">
									</div>
								</div>

								<div class="form-group">
									<label for="inputPassword2" class="col-sm-2 control-label">确认</label>
									<div class="col-sm-10">
										<input type="password" class="form-control"
											id="inputPassword2" placeholder="请确认密码">
									</div>
								</div>

								<div class="form-group">
									<label for="inputValidata" class="col-sm-2 control-label">
										<!--验证码-->
									</label>
									<div class="col-sm-4">
										<input type="text" class="form-control" id="inputValidata"
											placeholder="验证码">
									</div>
									<div class="col-sm-6">
										<img class="validata-img" src="${baseUrl }/validata/img"
											onclick="refreshCode()" />
										<!--<i class="icon-refresh icon-spin icon-large"></i>-->
									</div>
								</div>

								<!-- 								<div class="form-group has-error bg-danger" -->
								<!-- 									style="text-align: center;">注册为测试账户，在正式运行期间，测试账户会全部清除</div> -->

								<!-- 								<div class="form-group has-error"> -->
								<!-- 									<div class="col-sm-offset-2 col-sm-4"> -->
								<!-- 										<input type="text" class="form-control" id="dynamicValidata" -->
								<!-- 											placeholder="动态码"> -->
								<!-- 									</div> -->
								<!-- 									<div class="col-sm-6"> -->
								<!-- 										<a href="#" class="btn btn-default" role="button" -->
								<!-- 											id="dynamicValidataBtn" style="width: 120px;">获取动态码</a> -->
								<!-- 									</div> -->
								<!-- 								</div> -->

								<div class="form-group">
									<div class="col-sm-offset-2 col-sm-10">
										<button type="button" class="btn btn-default"
											id="registerButton">注&nbsp;册</button>
									</div>
								</div>
							</fieldset>
						</form>
					</div>

				</div>

			</section>

			<%@ include file="/WEB-INF/jsp/web/commons/footer.jsp"%>

		</div>
	</div>



</body>
<script>
	var registerForm = $('.register-form');
	$(function() {
		$('#registerButton').click(function() {
			var telphone = $.trim($('#inputAccount').val());
			var password = $.trim($('#inputPassword').val());
			var password2 = $.trim($('#inputPassword2').val());
			var validataImg = $.trim($('#inputValidata').val());

			var options = {
				msg : '',
				type : '',
				time : 3000,
				hasClose : true
			};

			if (telphone == '') {
				options.type = SELF_ALERT_TYPES.warning;
				options.msg = "请填写手机号";
				selfAlert(options);
				return;
			} else if (!telphone.match(/^\d{11}$/)) {
				options.type = SELF_ALERT_TYPES.warning;
				options.msg = "请正确输入手机号";
				selfAlert(options);
				return;
			}

			if (!password || password == '') {
				options.type = SELF_ALERT_TYPES.warning;
				options.msg = "请输入密码";
				selfAlert(options);
				return;
			} else if (password.length< 6 || password.length >16) {
				options.type = SELF_ALERT_TYPES.warning;
				options.msg = "密码:[6-16个字符，区分大小写]";
				selfAlert(options);
				return;
			} else if (funcChina(password)) {
				options.type = SELF_ALERT_TYPES.warning;
				options.msg = "密码中不能含有中文";
				selfAlert(options);
				return;
			}
			if (!password2 || $.password2 == '') {
				options.type = SELF_ALERT_TYPES.warning;
				options.msg = "请输入确认密码";
				selfAlert(options);
				return;
			}
			if (password != password2) {
				options.type = SELF_ALERT_TYPES.warning;
				options.msg = "两次密码不一致";
				selfAlert(options);
				return;
			}
			if (!validataImg) {
				options.type = SELF_ALERT_TYPES.warning;
				options.msg = "请输入图片验证码";
				selfAlert(options);
				return;
			}

			var data = {
				telphone : telphone,
				password : password,
				password2 : password2,
				validataImg : validataImg
			};
			$.ajax({
				async : false,
				type : "POST",
				data : data,
				url : "${baseUrl }/register",
				success : function(responseData) {
					if (responseData.responseCode == '000') {
						options.type = SELF_ALERT_TYPES.success;
						options.msg = "注册成功,正在跳转到登陆页面...";
						selfAlert(options);
						window.location.href = '${baseUrl}/login/page.html';
					} else {
						refreshCode();
						options.type = SELF_ALERT_TYPES.danger;
						options.msg = responseData.responseMessage;
						selfAlert(options);
					}
				}
			});
		});

		$('#dynamicValidataBtn').click(function() {
			var _this = $(this);
			if (!_this.hasClass("disabled")) {
				_this.addClass("disabled");
				_this.text('再次发送(40秒)');
			}
		});

		//监控表单enter事件
		registerForm.find('input').bind('keydown', function(e) {
			var key = e.which;
			if (key == 13) {
				$('#registerButton').trigger('click');
			}
		});

	});

	function funcChina(obj) {
		if (/.*[\u4e00-\u9fa5]+.*$/.test(obj)) {
			return true;
		}
		return false;
	}
	function refreshCode() {
		registerForm.find(".validata-img").attr("src",
				"${baseUrl }/validata/img?t=" + Math.random());
	}
</script>
<script src="${baseUrl }/resources/js/app.js" type="text/javascript">
	
</script>
</html>